package com.itheima.mapper;

import com.itheima.pojo.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface OrderMapper {

    List<Order> findByCondition(Order order);

    void add(Order order);

    Map findById(Integer id);

    Integer findOrderCountByDate(String today);

    Integer findOrderCountAfterDate(String thisWeekMonday);

    Integer findVisitsCountByDate(String today);

    Integer findVisitsCountAfterDate(String thisWeekMonday);

    List<Map<String, Object>> findHotSetmeal();

    void addressIdAndOrder(@Param("addressId") Integer addressId, @Param("orderId") Integer orderId);

    Integer findByMemberId(Integer id);

    //移动端获取套餐详情
    Map find4Detail(Map map);

    @Insert("insert into t_order value (NUll,#{member_id},#{orderDate},\"电话预约\",\"未到诊\",#{setmeal_id})")
    void addByCondition(@Param("orderDate") Date orderDate, @Param("setmeal_id") Integer setmealId, @Param("member_id") Integer id);

    Order findByOrderId(Integer id);

    void deleteById(Integer id);


    void changeStatusByY(Integer id);

    void changeStatusByW(Integer id);

    @Update("update t_order set orderDate=#{orderDate},orderType=#{orderType},orderStatus=#{orderStatus},setmeal_Id=#{setmeal_Id} where id=#{id}")
    void edit(@Param("id") Integer id,@Param("orderDate") Date orderDate,@Param("orderStatus") String orderStatus,@Param("orderType") String orderType, @Param("setmeal_Id")Integer setmeal_Id);
}
